<?php
namespace Cal\server;

use Cal\CalReply;
use Cal\CalRequest;
use Grpc\ServerContext;

/**
 *
 * @time 2022-7-25
 * @uthor 王恒兵
 */

class Server extends ServerSub
{
    public function Add(
        CalRequest          $request,
        ServerContext $context
    ): CalReply {
        $response = new CalReply();
        $response->setRes($request->getParameter1() + $request->getParameter2());
        return $response;
    }

    public function Sub(
        CalRequest $request,
        ServerContext $context
    ): CalReply {
        $response = new CalReply();
        $response->setRes($request->getParameter1() - $request->getParameter2());
        return $response;
    }
}